import { defineComponent, PropType } from 'vue';
import { useNamespace } from '@ibiz-template/vue3-util';
import { IPanelRawItem } from '@ibiz/model-core';
import { CoopPosController } from './coop-pos.controller';

export const CoopPos = defineComponent({
  name: 'IBizCoopPos',
  props: {
    modelData: {
      type: Object as PropType<IPanelRawItem>,
      required: true,
    },
    controller: {
      type: CoopPosController,
      required: true,
    },
  },
  setup(props) {
    const c = props.controller;
    const ns = useNamespace('coop-pos');

    return { ns, c };
  },
  render() {
    return (
      <div class={this.ns.b()}>
        <iBizCoopAlert key={this.c.state.key} {...this.c.state.alertParams} />
      </div>
    );
  },
});
